home *** CD-ROM | disk | FTP | other *** search
- package com.simeda.ActiveViewer;
-
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.Display;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Form;
- import javax.microedition.lcdui.TextField;
- import javax.microedition.rms.RecordStore;
- import javax.microedition.rms.RecordStoreException;
-
- public class ConnectForm extends Form {
- TextField hostname = new TextField("", "", 1, 1);
- TextField display = new TextField("", "", 1, 1);
- TextField password = new TextField("", "", 1, 1);
- Command connectCommand = new Command("Connect", 4, 1);
- // $FF: renamed from: rs javax.microedition.rms.RecordStore
- RecordStore field_0 = null;
- String currentDisplay = "";
- String currentHostname = "";
- String currentPassword = "";
- VNCViewer parent = null;
-
- public ConnectForm(VNCViewer var1) {
- super("Connection Information");
- this.parent = var1;
- ((Displayable)this).setCommandListener(new 1(this));
-
- try {
- this.jbInit();
- } catch (Exception var3) {
- ((Throwable)var3).printStackTrace();
- }
-
- }
-
- private void jbInit() {
- try {
- this.field_0 = RecordStore.openRecordStore("connectionInformation", true);
- int var1 = this.field_0.getNumRecords();
- if (var1 == 3) {
- byte[] var2 = this.field_0.getRecord(1);
- if (var2 != null) {
- this.currentDisplay = new String(var2);
- }
-
- var2 = this.field_0.getRecord(2);
- if (var2 != null) {
- this.currentHostname = new String(var2);
- }
-
- var2 = this.field_0.getRecord(3);
- if (var2 != null) {
- this.currentPassword = new String(var2);
- }
- }
- } catch (RecordStoreException var3) {
- ((Throwable)var3).printStackTrace();
- }
-
- this.display.setLabel("Display");
- this.display.setConstraints(2);
- this.display.setMaxSize(5);
- this.display.setString(this.currentDisplay);
- this.hostname.setLabel("Hostname");
- this.hostname.setConstraints(0);
- this.hostname.setMaxSize(30);
- this.hostname.setString(this.currentHostname);
- this.password.setLabel("Password");
- this.password.setConstraints(65536);
- this.password.setMaxSize(30);
- this.password.setString(this.currentPassword);
- ((Form)this).append(this.hostname);
- ((Form)this).append(this.display);
- ((Form)this).append(this.password);
- ((Displayable)this).addCommand(this.connectCommand);
- }
-
- public void this_commandPerformed(Command var1, Displayable var2) {
- if (var1.getLabel().equals("Connect")) {
- this.currentDisplay = this.display.getString();
- this.currentHostname = this.hostname.getString();
- this.currentPassword = this.password.getString();
- byte[] var3 = this.currentDisplay.getBytes();
- byte[] var4 = this.currentHostname.getBytes();
- byte[] var5 = this.currentPassword.getBytes();
- System.out.println("currentDisplay=" + this.currentDisplay);
-
- try {
- if (this.field_0.getNumRecords() == 0) {
- this.field_0.addRecord((byte[])null, 0, 0);
- this.field_0.addRecord((byte[])null, 0, 0);
- this.field_0.addRecord((byte[])null, 0, 0);
- }
-
- this.field_0.setRecord(1, var3, 0, var3.length);
- this.field_0.setRecord(2, var4, 0, var4.length);
- this.field_0.setRecord(3, var5, 0, var5.length);
- this.field_0.closeRecordStore();
- } catch (Exception var7) {
- ((Throwable)var7).printStackTrace();
- }
-
- VNCController var6 = new VNCController(this);
- var6.setHost(this.currentHostname);
- var6.setPort(5900 + Integer.parseInt(this.currentDisplay));
- var6.setPassword(this.currentPassword);
- var6.setDisplay(Display.getDisplay(this.parent));
- var6.doConnect();
- }
-
- }
- }
-